Skip to content

SYNTHESIZER: Add counterexample-guided loop assigns synthesis #7448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2022

Conversation

qinheping
Copy link
Collaborator

@qinheping qinheping commented Dec 20, 2022

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Implement the functionality described below.

Motivation

This loop assigns synthesizer use the idea counter-example-guided synthesis (CEGIS) to synthesize loop assigns targets. It is based on the same CEGIS framework as the loop invariant synthesizer w ith the following difference.

Use Cases

Our loop invariants synthesizer will synthesize invariants clauses for all loops without loop invariant annotation. The loop assigns synthesizer will synthesize assigns clauses for all loops without loop invariant annotation and loop assigns annotation.

Cause Loop ID

In the loop invariant synthesizer, we say a loop is a cause loop if the violation is dependent on the loop's havoc instructions. Because invariant clauses affect the havoced values which could flow into variables outside the loop. In the loop assigns synthesizer, we say a loop is a cause loop if the violation is in the loop. Because assigns clauses only affect the CAR of its own loop body.

Synthesizer

For an assignable violation with checked target T, the new assigns target will be T. If T is a non-constant target, e.g., ptr[i] with i also an assigns target, we widen it to __CPROVER_POINTER_OBJECT(T). We add the new target to cause loop one by one starting from the most-inner one. Until the assignable violation is resolved.

@qinheping qinheping self-assigned this Dec 20, 2022
@qinheping qinheping added aws Bugs or features of importance to AWS CBMC users aws-medium Synthesis Invariant synthesis Code Contracts Function and loop contracts labels Dec 20, 2022
@codecov
Copy link

codecov bot commented Dec 20, 2022

Codecov Report

Base: 78.46% // Head: 78.47% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (251c257) compared to base (6827ce5).
Patch coverage: 78.52% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7448      +/-   ##
===========================================
+ Coverage    78.46%   78.47%   +0.01%     
===========================================
  Files         1662     1662              
  Lines       190904   191013     +109     
===========================================
+ Hits        149794   149899     +105     
- Misses       41110    41114       +4     
Impacted Files Coverage Δ
...src/java_bytecode/java_bytecode_convert_method.cpp 97.67% <ø> (ø)
jbmc/src/java_bytecode/java_bytecode_language.cpp 92.60% <ø> (ø)
src/analyses/invariant_set.cpp 0.00% <0.00%> (ø)
src/ansi-c/ansi_c_declaration.h 95.00% <ø> (ø)
src/ansi-c/c_typecast.h 75.00% <ø> (ø)
src/ansi-c/c_typecheck_base.h 100.00% <ø> (ø)
src/cprover/simplify_state_expr.cpp 91.59% <ø> (ø)
src/goto-cc/as86_cmdline.cpp 0.00% <0.00%> (ø)
src/goto-cc/as_cmdline.cpp 0.00% <0.00%> (ø)
src/goto-cc/as_mode.cpp 0.00% <0.00%> (ø)
... and 215 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Implement the functionality described below.

Motivation
---
This loop assigns synthesizer use the idea counter-example-guided synthesis (CEGIS) to synthesize loop assigns targets. It is based on the same CEGIS framework as the loop invariant synthesizer w ith the following difference.

Use Cases
---
Our loop invariants synthesizer will synthesize invariants clauses for all loops without loop invariant annotation. The loop assigns synthesizer will synthesize assigns clauses for all loops without loop invariant annotation **and** loop assigns annotation.

Cause Loop ID
---
In the loop invariant synthesizer, we say a loop is a cause loop if the violation is dependent on the loop's havoc instructions. Because invariant clauses affect the havoced values which could flow into variables outside the loop. In the loop assigns synthesizer, we say a loop is a cause loop if the violation is in the loop. Because assigns clauses only affect the CAR of its own loop body.

Synthesizer
---
For an assignable violation with checked target `T`, the new assigns target will be `T`. If `T` is a non-constant target, e.g., `ptr[i]` with `i` also an assigns target, we widen it to `__CPROVER_POINTER_OBJECT(T)`. We add the new target to cause loop one by one starting from the most-inner one. Until the assignable violation is resolved.
@tautschnig tautschnig merged commit 48e1063 into diffblue:develop Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws Bugs or features of importance to AWS CBMC users aws-high Code Contracts Function and loop contracts Synthesis Invariant synthesis
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants